import 'package:flutter/material.dart';
import 'ListViewBuilderPage.dart';
import 'ListViewSeparatedPage.dart';
import 'CustomScrollViewPage.dart';

class ListViewDemoPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('ListView测试页面'),
        backgroundColor: Colors.purple,
      ),    //将参数当作页面标题

      body: new SingleChildScrollView(

        child: new Column(

          children: <Widget>[

            new Padding(
              padding: new EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
              child: new Row(
                children: <Widget>[
                  new Expanded(

                    child: new RaisedButton(
                      onPressed: (){

//                          Navigator.of(context).pop();//结束当前页面
                        Navigator.push(
                          context,
                          new MaterialPageRoute(builder: (context) => new ListViewBuilderPage()),
                        );
                      },
                      //通过控制 Text 的边距来控制控件的高度
                      child: new Padding(

                        padding: new EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 10.0),
                        child: new Text("ListView.builder构建ListView"),

                      ),
                      color: Colors.purple[300],
                    ),
                  ),
                ],
              ),
            ),

            new Padding(
              padding: new EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
              child: new Row(
                children: <Widget>[
                  new Expanded(

                    child: new RaisedButton(
                      onPressed: (){

//                          Navigator.of(context).pop();//结束当前页面
                        Navigator.push(
                          context,
                          new MaterialPageRoute(builder: (context) => new ListViewSeparatedPage()),
                        );
                      },
                      //通过控制 Text 的边距来控制控件的高度
                      child: new Padding(

                        padding: new EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 10.0),
                        child: new Text("ListView.separated构建ListView"),

                      ),
                      color: Colors.purple[300],
                    ),
                  ),
                ],
              ),
            ),

            new Padding(
              padding: new EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
              child: new Row(
                children: <Widget>[
                  new Expanded(

                    child: new RaisedButton(

                      onPressed: (){

//                          Navigator.of(context).pop();//结束当前页面
                        Navigator.push(
                          context,
                          new MaterialPageRoute(builder: (context) => new CustomScrollViewPage()),
                        );
                      },
                      //通过控制 Text 的边距来控制控件的高度
                      child: new Padding(

                        padding: new EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 10.0),
                        child: new Text("ListView 加入构建ListView"),

                      ),
                      color: Colors.purple[300],
                    ),
                  ),
                ],
              ),
            ),

          ],

        ),

      )
    );
  }
}